package com.qf.utils;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;

/**
 * Created by 54110 on 2021/3/2.
 */
public class CookieUtils {
    public String getToken(HttpServletRequest request){
        Cookie[] cookies = request.getCookies();
        if(cookies == null){
            return "";
        }else {
            String token = null;
            for (Cookie cook : cookies
            ) {
                if (cook.getName().equals("token")) {
                    token = cook.getValue();
                }
            }
            return token;
        }
    }
}
